<?php
declare(strict_types=1);
namespace App\Model\HmCommodityModel;

use Hyperf\DbConnection\Db;
use App\Model\BaseModel\BaseHmCommodityModel;

class HmSupplierCompany extends BaseHmCommodityModel
{
    public $table = 'hm_suppliercompany_s2b';
    protected $casts = [
        'ID' => 'string',
    ];
    
    /**
     * 获取单个供应商信息
     * @param string $SupplierCode
     */
    public function getSupplierListBySupplierCode(string $supplierCode)
    {
        $object = $this->
        select([
            Db::raw("CONCAT(s.ID,'') AS ID"),
            "SupplierCode",
            "SupplierName",
        ])
        ->from($this->table. " as s")
        ->where("SupplierCode",$supplierCode)
        ->first();
        return $object ? $object->toArray() : [];
    }
}